# Maintainer: Patrycja Rosa <alpine@ptrcnull.me>
pkgname=sbctl
pkgver=0.13
pkgrel=0
pkgdesc="Secure Boot key manager"
url="https://github.com/Foxboron/sbctl/"
arch="all"
license="MIT"
depends="binutils lsblk"
makedepends="asciidoc go"
subpackages="
	$pkgname-doc
	$pkgname-bash-completion
	$pkgname-fish-completion
	$pkgname-zsh-completion
	"
source="https://github.com/Foxboron/sbctl/releases/download/$pkgver/sbctl-$pkgver.tar.gz"

export GOCACHE="${GOCACHE:-"$srcdir/go-cache"}"
export GOTMPDIR="${GOTMPDIR:-"$srcdir"}"
export GOMODCACHE="${GOMODCACHE:-"$srcdir/go"}"

build() {
	make
	./sbctl completion bash > sbctl.bash
	./sbctl completion fish > sbctl.fish
	./sbctl completion zsh > sbctl.zsh
}

check() {
	make test
}

package() {
	install -D -m755 sbctl -t "$pkgdir"/usr/bin
	install -D -m644 sbctl.bash \
		"$pkgdir"/usr/share/bash-completion/completions/sbctl
	install -D -m644 sbctl.fish \
		"$pkgdir"/usr/share/fish/vendor_completions.d/sbctl.fish
	install -D -m644 sbctl.zsh \
		"$pkgdir"/usr/share/zsh/site-functions/_sbctl
	install -D -m644 docs/sbctl.8 \
		-t "$pkgdir"/usr/share/man/man8
}

sha512sums="
02c1f3e745f83f0e0a2fe90974f940a314aadbe26bd0d0c3e314bb3720b72c74715a26c891f8b22023f40eb8d1d8d24a7d2b1bc1c5d60f9781971f7e97224a4c  sbctl-0.13.tar.gz
"
